<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>Acount Model Config</title>
	
	<jsp:include page="/core/tool/resources.jsp?models=echarts"></jsp:include>
	<script src="./assetreport.js"></script>
</head>
<body>

	<div id="toolbar" style="margin-bottom:5px">
	    <a class="easyui-linkbutton" iconCls="icon-reload" onclick="refresh()">刷新</a> 
	    <a class="easyui-linkbutton" iconCls="icon-reload" onclick="refresh(true)">强制刷新</a>
	    <a class="easyui-linkbutton" onclick="refreshStatus('lastDay')">前一日持仓</a> 
       	<a class="easyui-linkbutton" onclick="refreshStatus('nextDay')">后一日持仓</a>
       	
		<form id="requestForm" name="requestForm"  class="easyui-form" style="margin-top:5px">
			开始日期：<input class="easyui-datebox" name="beginDate" data-options="onChange:changeBeginDate,onSelect:userSelect"/>
			<label><input name="beginDateType" type="radio" value="thisMonth"/>当月 </label> 
			<label><input name="beginDateType" type="radio" value="threeMonth"/>三月</label> 
			<label><input name="beginDateType" type="radio" value="thisYear"/>当年</label> 
			<label><input name="beginDateType" type="radio" value="all"/>全部 </label>
       	</form>
    </div>
    
    <div class="easyui-panel" title="持仓与交易" style="width:100%;" data-options="collapsible:true">
		<form id="acountStatusForm" class="easyui-flexform" data-options="cellWidth:200,cellMargin:3">
			<div>
				<label>账户:</label>
		 		<div><input id="acountId" class="easyui-combobox"  name="acountId" 
		 			data-options="url:'../../base/acount/allparent.json',
		 				textField:'acountName',
		 				valueField:'acountId',
		 				onChange:changeAcount,
		 				loadFilter:function(data){return data.acounts}"/></div>
		 	</div>
			<div>
		 		<label>日期:</label>
				<div><input class="easyui-datebox" name="summaryDate" id="summaryDate" data-options="onChange:changeStatusDate,onSelect:userSelect"/></div>
		 	</div>
		 	<div>
				<label>净值:</label>
				<div><input class="easyui-numberbox" name="netAssert" data-options="readonly:true"/></div>
			</div>
		 	<div>
				<label>市值:</label>
				<div><input class="easyui-numberbox" name="marketValue" data-options="readonly:true"/></div>
			</div>
			<div>
				<label>仓位%:</label>
				<div><input class="easyui-numberbox" name="posRatio" data-options="readonly:true,precision:2,suffix:'%'"/></div>
			</div>
		 	<div>
				<label>现金:</label>
				<div><input class="easyui-numberbox" name="cash" data-options="readonly:true"/></div>
			</div>
		 	<div>
				<label>总收益%:</label>
				<div><input class="easyui-numberbox" name="profit" data-options="readonly:true,precision:2, suffix:'%'"/></div>
			</div>
		 	<div>
				<label>总收益:</label>
				<div><input class="easyui-numberbox" name="profitMoney" data-options="readonly:true"/></div>
			</div>
		 	<div>
		 		<label>当日收益%:</label>
				<div><input class="easyui-numberbox" name="profitDay" data-options="readonly:true,precision:2, suffix:'%'"/></div>
			</div>
		 	<div>
		 		<label>当日收益:</label>
				<div><input class="easyui-numberbox" name="profitDayMoney" data-options="readonly:true "/></div>
			</div>
		</form>


		<table id="acountStatus"  class="easyui-edatagrid" style="width:100%;"
	            data-options="rownumbers:true, singleSelect:true, pagination:false, sortOrder:'desc', sortName:'secValue', remoteSort:false">
	        <thead data-options="frozen:true">
				<tr>           	 	
					<th data-options="field:'secName',width:100">名称</th>
				</tr>
			</thead>
	        <thead>
	            <tr>
			        <th data-options="field:'secId',width:80, sortable:true">代码</th>
			        <th data-options="field:'secValue',width:80, align:'right', editor:'numberbox', sortable:true">市值</th>
			        <th data-options="field:'posRatio',width:80, align:'right', formatter:posRatioFormatter, sortable:true">占比%</th>
			        
			        <th data-options="field:'profitMoney',width:80, align:'right', editor:{type:'numberbox'}, sortable:true">总收益</th>
			        <th data-options="field:'profit',width:80, align:'right', editor:{type:'numberbox',options:{precision:2,suffix:'%'}}, sortable:true">总收益%</th>
			        <th data-options="field:'profitDayMoney',width:80, align:'right', editor:{type:'numberbox'},styler:profitStyle, sortable:true">当日收益</th>
	 				<th data-options="field:'profitDay',width:80, align:'right', editor:{type:'numberbox',options:{precision:2,suffix:'%'}},styler:profitStyle, sortable:true">当日收益%</th>
	
					<th data-options="field:'shareCost',width:80, align:'right', editor:{type:'numberbox',options:{precision:3}}">持仓成本</th>
			        <th data-options="field:'price',width:80, align:'right', editor:{type:'numberbox',options:{precision:3}}">价格</th>
			        <th data-options="field:'percent',width:80, align:'right', editor:{type:'numberbox',options:{precision:2,suffix:'%'}}, sortable:true">涨幅%</th>
			        <th data-options="field:'secNum',width:80, align:'right', editor:'numberbox'">持仓</th>
			        <th data-options="field:'secNumAfs',width:80, align:'right', editor:'numberbox'">持仓afs</th>
			        <th data-options="field:'buyDate',width:90, align:'right'">买入日期</th>
	            </tr>
	        </thead>
	    </table>
	    <table id="bill" class="easyui-edatagrid" style="width:100%" 
			data-options="rownumbers:true,singleSelect:false,sortOrder:'asc', sortName:'billTime', remoteSort:false, editing:false">
	        <thead>
	            <tr>
	           	 	<th data-options="field:'billTime',width:130,order:'desc',editor:'datetimebox', sortable:true">交易时间</th>
	                <th data-options="field:'billType',width:80, formconfig:{type:'combobox',options:{flexset:'TRADE_TYPE'}}">类别</th>
	                <th data-options="field:'secId',width:80">代码</th>
	                <th data-options="field:'secName', width:100 ">名称</th>
	                <th data-options="field:'billMoney',width:80,align:'right', editor:{type:'numberbox',options:{precision:2}}">交易金额</th>
	                <th data-options="field:'billTradeMoney',width:80,align:'right', editor:{type:'numberbox',options:{precision:2}}">交易净额</th>
	                <th data-options="field:'secNum',width:80,align:'right',editor:'numberbox',styler:profitStyle">数量</th>
	                <th data-options="field:'secPrice',width:80,align:'right',editor:{type:'numberbox',options:{precision:3}}">价格</th>
	                <th data-options="field:'bondInterest',width:80,align:'right',editor:{type:'numberbox',options:{precision:2}}">利息</th>
	                <th data-options="field:'feeCommision',width:80,align:'right',editor:{type:'numberbox',options:{precision:2}}">佣金</th>
	                <th data-options="field:'feeTax',width:80,align:'right',editor:{type:'numberbox',options:{precision:2}}">印花</th>
	                <th data-options="field:'feeOther',width:80,align:'right',editor:{type:'numberbox',options:{precision:2}}">其它</th>
	                <th data-options="field:'feeAll',width:80,align:'right',editor:{type:'numberbox',options:{precision:2}}">费用合计</th>
	                <th data-options="field:'billDesc',width:300">说明</th>
	            </tr>
	        </thead>
	    </table>
	</div>
	    
    <div style="height:5px"></div>
    <div id="report1Container" class="easyui-panel" title="收益图" style="width:100%;" data-options="collapsible:true">
     <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
    	<div id="report1" style="width:1100px;height:500px;"></div>
    </div>
    <div style="height:5px"></div>
    <div class="easyui-panel" title="资产图" style="width:100%;" data-options="collapsible:true">
    	<div id="report2" style="width: 1100px;height:500px;"></div>
 	</div>
 
</body>
</html>